package com.edu.bhu.admin.service.impl;

import java.util.List;

import com.edu.bhu.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.edu.bhu.admin.mapper.CosCosmeticsMapper;
import com.edu.bhu.admin.domain.CosCosmetics;
import com.edu.bhu.admin.service.ICosCosmeticsService;
import com.edu.bhu.common.core.text.Convert;

/**
 * 商品Service业务层处理
 * 
 * @author wangjinao
 * @date 2022-03-17
 */
@Service
public class CosCosmeticsServiceImpl implements ICosCosmeticsService 
{
    @Autowired
    private CosCosmeticsMapper cosCosmeticsMapper;

    /**
     * 查询商品
     * 
     * @param cosId 商品主键
     * @return 商品
     */
    @Override
    public CosCosmetics selectCosCosmeticsByCosId(Long cosId)
    {
        return cosCosmeticsMapper.selectCosCosmeticsByCosId(cosId);
    }

    /**
     * 查询商品列表
     * 
     * @param cosCosmetics 商品
     * @return 商品
     */
    @Override
    public List<CosCosmetics> selectCosCosmeticsList(CosCosmetics cosCosmetics)
    {
        return cosCosmeticsMapper.selectCosCosmeticsList(cosCosmetics);
    }

    /**
     * 新增商品
     * 
     * @param cosCosmetics 商品
     * @return 结果
     */
    @Override
    public int insertCosCosmetics(CosCosmetics cosCosmetics)
    {
        cosCosmetics.setUpdateDate(DateUtils.getNowDate());
        return cosCosmeticsMapper.insertCosCosmetics(cosCosmetics);
    }

    /**
     * 修改商品
     * 
     * @param cosCosmetics 商品
     * @return 结果
     */
    @Override
    public int updateCosCosmetics(CosCosmetics cosCosmetics)
    {
        cosCosmetics.setUpdateDate(DateUtils.getNowDate());
        return cosCosmeticsMapper.updateCosCosmetics(cosCosmetics);
    }

    /**
     * 图书状态修改
     *
     * @param cosCosmetics 商品信息
     * @return 结果
     */
    @Override
    public int changeStatus(CosCosmetics cosCosmetics)
    {
        return cosCosmeticsMapper.updateCosCosmetics(cosCosmetics);
    }

    /**
     * 批量删除商品
     * 
     * @param cosIds 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteCosCosmeticsByCosIds(String cosIds)
    {
        return cosCosmeticsMapper.deleteCosCosmeticsByCosIds(Convert.toStrArray(cosIds));
    }

    /**
     * 删除商品信息
     * 
     * @param cosId 商品主键
     * @return 结果
     */
    @Override
    public int deleteCosCosmeticsByCosId(Long cosId)
    {
        return cosCosmeticsMapper.deleteCosCosmeticsByCosId(cosId);
    }
}
